

        /*提交答案----------------------------*/

          function confim(title,content,buttons){
              appcan.window.confirm(title,content,buttons);
          }
                          
          //提交考题
          function tijiao(){

            IC.talkingDataCount("培训考试","00010");

             
              //获取页面中选择的选项;
              var obj=appcan.locStorage.getVal("subjectItemId");
                         //获取当前页面 考题id
              var ti_page=appcan.locStorage.getVal("subjectId");
                      
              if(obj==null||obj==""){
                    confim("提示","请先选择一个选项","确定");
            
                    return false;
              }
              else{
                      
                  //var url="http://172.31.64.34:8011/sdk10098/public/yddfMAS/saveExamResult?"

                  //var url="http://172.31.65.220:8081/sdk10098/public/yddfMAS/saveExamResult?"

                  // var url="http://store.ceair.com/mas/sdk10098/public/yddfMAS/saveExamResult?";

                  var url=h_yddfUrl+"yddfMAS/saveExamResult?";
                  var userId=appcan.locStorage.getVal("userId");
                  var examId=appcan.locStorage.getVal("examId");
                  var paperId=appcan.locStorage.getVal("paperId");
                  var subjectId=ti_page,subjectItemId=obj;
                  var data={"userId":userId,"examId":examId,"paperId":paperId,"subjectId":subjectId,"subjectItemId":subjectItemId};
                              //console.log(data);
                  $.ajax({
                      url:url,
                      data:data,
                      type:"get",
                      dataType:"json",
                      success:function(data){
                        //先默认移除答题卡内的提醒消息
                        $("#timuPage").children("p").remove();//加载的时候  默认移除提示消息;
                          appcan.window.confirm({
                              title:'提示',
                              content:'提交成功',
                              buttons:['确定'],
                              callback:function(err,data,dataType,optId){
                                    var see=appcan.locStorage.getVal("userSelect");//获取用户选择的答案;
                                    checkBool(see);
                              }
                          });
                          //获取当前页面的索引值
                          var arr=[];
                          var ind=Number(appcan.locStorage.getVal("index"));
                          $("#munu li").each(function(){
                              var val=$(this).find("#check").attr("value");//获取每道题的正确值
                              var bianhao=$(this).find("#bianhao").attr("value");//获取每一道题的编号
                              if(val=="true"){
                                      arr.push(bianhao);//将正确信息放到一个对象集合中
                              }
                          })
                          var trueKey=arr.join(",");//获取当前题目的正确集合
                          //获取用户本地选项存储
                          var sele=appcan.locStorage.getVal("userSelect");
                          //判断选择的是否为正确选项
                          if(trueKey==sele){
                                    //回答正确选项标记
                              $(".dati li").eq(ind).css({"background":"green","color":"#ffffff"});
                          }
                          else{
                                    //打错选项标记
                              $(".dati li").eq(ind).css({"background":"red","color":"#ffffff"});
                          }
                                appcan.locStorage.setVal("status","1");//提交成功以后保存一个状态到本地
                      },
                      error:function(){
                          confim("提示","提交异常","确定");
                      }
                  })
              }
          }
          function checkBool(res){
            IC.talkingDataCount("培训考试","00010");
            //提交状态*****************************有待改进

              //获取后台用户选项记录

              var arr=[];
              $("#munu li").each(function(){
                  var val=$(this).find("#check").attr("value");
                  var log=$(this).find(".tit_log");
                  var bianhao=$(this).find("#bianhao").attr("value");//获取每一道题的编号
                  if(val=="false"){
                    log.addClass("err_log");
                  }
                  else{
                    log.addClass("right_log");
                    arr.push(bianhao);//将正确信息放到一个对象集合中
                  }
              })
              //在本地取出用户选择的结果
              var arrStr=(arr.join(","));//将正确结果转化成字符串形式
              var tip=$("<p>正确选项: <i>"+arr+"</i></p><p>您所选:(<i>"+arr+"</i>)&nbsp;回答正确,厉害哦</p>");
              var tipError=$("<p>正确选项: <i>"+arr+"</i></p><p>您所选:(<i>"+res+"</i>)&nbsp;回答错误,继续加油哦!</p>");
              //定义判断状态 
              (res==arrStr)?$("#timuPage").append(tip):$("#timuPage").append(tipError);
              $("#timuPage p").css({
                  "width":"90%",
                  "margin":".7em 5%",
                  "color":"red",
              })
              $("#timuPage p").find("i").css({
                  "font-style":"normal",
                  "font-weight":"bold",
                  "color":"green"
              })
          }




